<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="include/peizhi.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="${ctx}">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
        
        <title>后台管理中心</title> 
		<link rel="stylesheet" href="${ctx}/css/pintuer.css" /> 
		<link rel="stylesheet" href="${ctx}/css/admin.css" /> 
        <script type="text/javascript" src="${ctx}/js/jquery-1.9.1.min.js"></script>
        <script type="text/javascript" src="${ctx}/js/pagehoutai.js"></script>
<style type="text/css">
</style>
    </head>

  	<body style="background-color:#f2f9fd;"> 
	  <jsp:include page="include/header.jsp" flush="true"/>
  <div class="admin"> 
  	<div class="panel admin-panel">
	  <div class="panel-head"><strong class="icon-reorder"> 内容列表</strong></div>
	  <div class="padding border-bottom">  
	  <a class="button border-yellow" href="${ctx}/ht/column/addCoumn"><span class="icon-plus-square-o"></span> 添加栏目</a>注：主要给开发人员使用的
	  </div> 
	  <table id='pagehtml' class="table table-hover text-center">
	    
	  </table>
	<form id="pageForm" action="${ctx}/ht/column/getList">
		<input type="hidden" name="pageNo" id="pageNo" value="0" /> 
		<input type="hidden" name="pageSize" id="pageSize" value="8" /> 
		<input id='lastPage' type="hidden">
	</form>
	</div>
	<script>
	function del(id){
		if(confirm("您确定要删除吗?")){
			$.ajax({
				url:"${ctx}/ht/column/del",
				data:"id="+id,
				type:"post",
				success:function(data){
					window.location.href="${ctx}/ht/column";
				}
			});
		}
	}
	
	var listhead='<tr>'+
	      '<th width="15%">排序</th>'+ 
	      '<th width="20%">栏目名称</th>'+
	      '<th width="20%">英文名称</th>'+
	     ' <th width="25%">操作</th>'+
	    	'</tr>';
	var listhtml = "<tr'>";
		  listhtml = listhtml + "<td>{0}</td>";
	      listhtml = listhtml + "<td>{1}</td>";     
	      listhtml = listhtml + "<td>{2}</td>";
	      listhtml = listhtml + "<td><div class='button-group'>";
	      listhtml = listhtml + "{6}";
	      listhtml = listhtml + "<a class='button border-main' href='${ctx}/ht/column/addCoumn?id={7}'><span class='icon-edit'></span> 修改</a>";
	      listhtml = listhtml + "<a class='button border-red' href='javascript:void(0)' onclick='del({4})'><span class='icon-trash-o'></span> 删除</a>";
	      listhtml = listhtml + "</div></td>";
		  listhtml = listhtml + "</tr>";
	var ht1 = "<a class='button border-main' href='${ctx}/ht/column/contentList?reserve={3}'> 展开列表</a>";
	var ht2 = "<a class='button border-main' href='${ctx}/ht/column/addCoumnContent?id={3}'><span class='icon-edit'></span> 发布内容</a>";
	var ht3 = "<a class='button border-main' href='${ctx}/ht/column/addCoumn?id={7}'><span class='icon-edit'></span> 修改</a>";
	function pageAppend(data){
		if(data.ispage=='0'){
		return listhtml.replace('{0}',data.reserve)
		.replace('{1}',data.name)
		.replace('{2}',data.eName)
		.replace('{6}',ht2)
		.replace('{3}',data.id)
		.replace('{4}',data.id)
		.replace('{5}',data.id)
		.replace('{7}',data.id);
		}else if(data.name=="添加文章"){
			return listhtml.replace('{0}',data.reserve)
			.replace('{1}',data.name)
			.replace('{2}',data.eName)
			.replace('{6}',ht1)
			.replace('{3}',data.id)
			.replace('{4}',data.id)
			.replace('{5}',data.id)
			.replace('{7}',data.id);
		}else if(data.ispage=='1'){
			return listhtml.replace('{0}',data.reserve)
		.replace('{1}',data.name)
		.replace('{2}',data.eName)
		.replace('{6}',"")
		.replace('{3}',data.id)
		.replace('{4}',data.id)
		.replace('{5}',data.id)
		.replace('{7}',data.id);
		}
	}
	page($("#pageNo").val()+1,$("#pageSize").val());
	</script>
  </div> 
 </body>
</html>